#include"UDP_Client.hpp"
#include<iostream>

int main(int argc,char* argv[])
{
    if(argc != 3)
    {
        printf("Usage ./dict_client [ip] [port]\n");
    }
    UDPClient client(argv[1],atoi(argv[2]));
    for(;;)
    {
        std::string word;
        std::cout << "请输入你要查找的单词";
        std::cin >> word;
        if(!std::cin)
        {
            std::cout << "Good Bye" << std::endl;
            break;
        }
        client.SendTo(word);
        std::string result;
        client.RecvFrom(&result);
        std::cout << word << "意思是" << result << std::endl;
    }

    return 0;
}